package bu.met.cs664;

/**
 * Created by mcox on 10/9/14.
 */
public enum Actions {
    MOVE_NORTH('n'),
    MOVE_EAST('e'),
    MOVE_SOUTH('s'),
    MOVE_WEST('w'),
    SHOOT_NORTH('N'),
    SHOOT_EAST('E'),
    SHOOT_SOUTH('S'),
    SHOOT_WEST('W'),
    EXIT('U'),
    PICK_UP_GOLD('P');

    private char action;

    private Actions(char action) {
        this.action = action;
    }

    public char toChar() {
        return action;
    }

    public static Actions fromString(char action) {
        for (Actions actions : Actions.values()) {
            if (actions.toChar() == action) {
                return actions;
            }
        }

        return null;
    }
}
